﻿using Airthmetic;
using BaseTool;
using System;
using System.Reflection;
using System.Text;
using System.Windows.Forms;

namespace StructuredLightSystemUI
{
    /// <summary>
    /// 关于窗体
    /// </summary>
    public partial class AboutForm : InnerForm
    {
        /// <summary> 网址一 </summary>
        private string URL1 = $"https://space.bilibili.com/1807055";
        /// <summary> 网址二 </summary>
        private string URL2 = $"https://www.xx-3dtech.cn";
        /// <summary> 网址三 </summary>
        private string URL3 = $"https://detail.1688.com/offer/989248559336.html";
        /// <summary> 网址四 </summary>
        private string URL4 = $"https://detail.1688.com/offer/979178258743.html"; 
        /// <summary> 网址五 </summary>
        private string URL5 = $"https://www.bilibili.com/video/BV15KeSzwEL3/";

        #region 构造、初始化
        /// <summary>
        /// 构造
        /// </summary>
        public AboutForm()
        {
            InitializeComponent();
        }
        //加载前
        private void AboutForm_Load(object sender, EventArgs e)
        {
            this.label1.Text =
                $"【软件算法支持】\r\n" +
                $"B站-美琴小学生\r\n" +
                $"Q群：853973880\r\n" +
                $"视频地址：{URL5}";
            this.label2.Text =
                $"【硬件支持】\r\n" +
                $"响西智能科技（重庆）有限公司\r\n" +
                $"淘宝地址1：{URL3}\r\n" +
                $"淘宝地址2：{URL4}\r\n" +
                $"公司地址：{URL2}";
        }
        //显示后
        private void AboutForm_Shown(object sender, EventArgs e)
        {
            //固定大小
            this.IsFixed = true;

            //文本信息
            StringBuilder sb = new StringBuilder();
            sb.AppendLine($"------------------------------------------------------------");
            sb.AppendLine($"UI版本：{Assembly.GetExecutingAssembly().GetName().Version.ToString()}");
            sb.AppendLine($"接口库版本：{Assembly.GetAssembly(typeof(PathTool)).GetName().Version.ToString()}");
            sb.AppendLine($"算法库版本：{Assembly.GetAssembly(typeof(RabbitTool)).GetName().Version.ToString()}");
            sb.AppendLine($"------------------------------------------------------------");
            richTextBox1.Text = sb.ToString();
        }
        //正在关闭
        private void AboutForm_FormClosing(object sender, FormClosingEventArgs e)
        {

        }
        //已经关闭
        private void AboutForm_FormClosed(object sender, FormClosedEventArgs e)
        {

        }
        #endregion

        #region 控件事件
        //网址一
        private void label1_Click(object sender, EventArgs e)
        {
            try
            {
                System.Diagnostics.Process.Start(URL5);
            }
            catch (Exception ex)
            {
                Log.SaveError(ex);
            }
        }
        //网址二
        private void label2_Click(object sender, EventArgs e)
        {
            try
            {
                System.Diagnostics.Process.Start(URL2);
                System.Diagnostics.Process.Start(URL3);
                System.Diagnostics.Process.Start(URL4);
            }
            catch (Exception ex)
            {
                Log.SaveError(ex);
            }
        }
        #endregion
    }
}
